home *** CD-ROM | disk | FTP | other *** search
/ Better Homes & Gardens: …oking for Today - Chicken / Image.iso / pc / shared.dxr / 01002_printer .ls < prev    next >
Encoding:
Text File  |  1995-11-21  |  3.7 KB  |  133 lines

  1. on openPrinter
  2.   global gPrinterObj
  3.   closePrinter()
  4.   openXLib("print_x")
  5.   set gPrinterObj to PRINT_X(mnew)
  6. end
  7.  
  8. on closePrinter
  9.   global gPrinterObj
  10.   if objectp(gPrinterObj) then
  11.     gPrinterObj(mdispose)
  12.   end if
  13. end
  14.  
  15. on printRecipe
  16.   global gPrinterObj, gCurrentNote
  17.   put field "ingredients" into field "ingredients print"
  18.   put field "instructions" into field "instructions print"
  19.   set body to field "title" & RETURN & RETURN & "Ingredients:" & RETURN & RETURN & removeReturns("ingredients print") & RETURN & RETURN & "Instructions:" & RETURN & RETURN & field "instructions print"
  20.   getnotes()
  21.   put RETURN after body
  22.   put "Note:" after body
  23.   put RETURN after body
  24.   put gCurrentNote after body
  25.   put RETURN after body
  26.   put RETURN after body
  27.   put "Copyright 1995, Multicom Publishing, Inc." & RETURN after body
  28.   set bodies to []
  29.   repeat while 1
  30.     if the number of lines in body > 56 then
  31.       add(bodies, line 1 to 56 of body)
  32.       delete line 1 to 56 of body
  33.       next repeat
  34.     end if
  35.     add(bodies, body)
  36.     exit repeat
  37.   end repeat
  38.   repeat with body in bodies
  39.     openPrinter()
  40.     gPrinterObj(mSetBodyStyle, "times", 10, 0)
  41.     gPrinterObj(mSetBodyTop, 0)
  42.     gPrinterObj(mPrintPage, EMPTY, EMPTY, body, EMPTY, 0)
  43.     closePrinter()
  44.     waste()
  45.   end repeat
  46. end
  47.  
  48. on printShopping
  49.   global gPrinterObj, gShoppingTitles
  50.   set body to EMPTY
  51.   set body to "Shopping list for the following recipe(s):"
  52.   put RETURN after body
  53.   put RETURN after body
  54.   repeat with i in gShoppingTitles
  55.     put i & RETURN after body
  56.   end repeat
  57.   put RETURN after body
  58.   put RETURN & field "list" after body
  59.   set numberOfLines to the number of lines in body
  60.   set linesOnLastPage to numberOfLines mod 56
  61.   if linesOnLastPage < 55 then
  62.     repeat with i = linesOnLastPage to 55
  63.       put RETURN after body
  64.     end repeat
  65.     put "Copyright 1995, Multicom Publishing, Inc." after body
  66.   else
  67.     put RETURN & "Copyright 1995, Multicom Publishing, Inc." after body
  68.   end if
  69.   set bodies to []
  70.   repeat while 1
  71.     if the number of lines in body > 56 then
  72.       add(bodies, line 1 to 56 of body)
  73.       delete line 1 to 56 of body
  74.       next repeat
  75.     end if
  76.     add(bodies, body)
  77.     exit repeat
  78.   end repeat
  79.   repeat with body in bodies
  80.     openPrinter()
  81.     gPrinterObj(mSetBodyStyle, "times", 10, 0)
  82.     gPrinterObj(mSetBodyTop, 20)
  83.     gPrinterObj(mPrintPage, EMPTY, EMPTY, body, EMPTY, 0)
  84.     closePrinter()
  85.     waste()
  86.   end repeat
  87. end
  88.  
  89. on printPlanner
  90.   global gPrinterObj
  91.   set title to "Meal Plan for " & field "name" & " " & field "month" & " " & field "day" & ", " & field "year"
  92.   if the frame = label("weekly") then
  93.     set body to title & RETURN & RETURN & field "days" & RETURN & RETURN & field "weekNotes"
  94.   else
  95.     set body to title & RETURN & RETURN & field "meals" & RETURN & RETURN & field "dayNotes"
  96.   end if
  97.   set numberOfLines to the number of lines in body
  98.   set linesOnLastPage to numberOfLines mod 56
  99.   if linesOnLastPage < 54 then
  100.     repeat with i = linesOnLastPage to 54
  101.       put RETURN after body
  102.     end repeat
  103.     put "Copyright 1995, Multicom Publishing, Inc." after body
  104.   else
  105.     put RETURN & "Copyright 1995, Multicom Publishing, Inc." after body
  106.   end if
  107.   set bodies to []
  108.   repeat while 1
  109.     if the number of lines in body > 56 then
  110.       add(bodies, line 1 to 56 of body)
  111.       delete line 1 to 56 of body
  112.       next repeat
  113.     end if
  114.     add(bodies, body)
  115.     exit repeat
  116.   end repeat
  117.   repeat with body in bodies
  118.     openPrinter()
  119.     gPrinterObj(mSetBodyStyle, "times", 10, 0)
  120.     gPrinterObj(mSetBodyTop, 20)
  121.     gPrinterObj(mPrintPage, EMPTY, EMPTY, body, EMPTY, 0)
  122.     closePrinter()
  123.     waste()
  124.   end repeat
  125. end
  126.  
  127. on waste
  128.   startTimer()
  129.   repeat while the timer < 120
  130.     updateStage()
  131.   end repeat
  132. end
  133.